﻿<%@ Page Title="" Language="C#" MasterPageFile="~/administrator/backend.Master" AutoEventWireup="true"
    CodeBehind="excercise-add.aspx.cs" Inherits="VQWEB.administrator.english.excercises.excercise_add" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content_backend" runat="server">
    <form id="frm_excercise" runat="server" role="form">
    <asp:FormView ID="frmExcercise" RenderOuterTable="false" runat="server">
        <EditItemTemplate>
            <div class="form-group">
                <label>
                    Tieu de bai tap</label>
                <input class="form-control" name="excercise_title" type="text" value='<%# Eval("excercise_title") %>' />
            </div>
            <div class="form-group">
                <label>
                    Noi dung bai tap</label>
                <textarea class="form-control" cols="3" name="excercise_content" rows="3"><%# Eval("excercise_content")%></textarea>
            </div>
            <div class="form-group">
                <label>
                    Dap an</label>
                <input class="form-control" name="excercise_answer" type="text" value='<%# Eval("excercise_answer") %>' />
            </div>
            <div class="form-group">
                <label>
                    Giai thich</label>
                <input class="form-control" name="excercise_explain" type="text" value='<%# Eval("excercise_explain") %>' />
            </div>
            <div class="form-group">
                <label>
                    Files</label>
                <input class="form-control" id="get_files" name="excercise_file" type="text" value='<%# Eval("excercise_file") %>' />
            </div>

             <div class="radio">
                <label>
                    <input type="radio" name="type_code" value="read" <%# Eval("type_code") != null && Eval("type_code").Equals("read") ? " checked='checked'" : null %> />
                    Select Reading
                </label>
            </div>
            <div class="radio">
                <label>
                    <input type="radio" name="type_code" value="listen"  <%# Eval("type_code") != null && Eval("type_code").Equals("listen") ? " checked='checked'" : null %> />
                    Or Select Listening
                </label>
            </div>

            <div class="checkbox">
                <label>
                    <input name="excercise_active" type="checkbox" <%# Eval("excercise_active") !=null && (bool)(Eval("excercise_active")) ? " checked='checked'" : null %>
                        value="True">
                    Active
                </label>
            </div>
            <input name="excercise_id" type="hidden" value='<%# (Eval("excercise_id") != null) ? Eval("excercise_id") : "0" %>' />
        </EditItemTemplate>
    </asp:FormView>
    </form>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Script_backend" runat="server">
    <script type="text/javascript">
        ShowToolBar("edit");
        var url_ashx = "/admin/english/excercise/handler";
        $("#btnCancel").live("click", function () {
            window.location = "/admin/english/excercise/list";
        });
        $("#btnSave").live("click", function () {
            var arr = $("#frm_excercise").serializeObject();
            $.post(url_ashx, { add_excercise: window.escape(arr) }, function (data) {
                alert(data);
                window.location = "/admin/english/excercise/list";
            });
        });
    </script>
</asp:Content>
